# -*- coding:utf-8 -*-
#! python3

from facecat import *

gPaint = FCPaint() #创建绘图对象
gPaint.defaultUIStyle = "dark"

#消息循环
def WndProc(hwnd,msg,wParam,lParam):
	return WndProcDefault(gPaint,hwnd,msg,wParam,lParam)

#创建窗体
createMainWindow(gPaint, "facecat-py", WndProc)

#创建布局层
layout = FCLayoutDiv()
#添加到框架
addView(layout, gPaint)
#显示横向滚动条
layout.showHScrollBar = True
#显示纵向滚动条
layout.showVScrollBar = True
#根据主题配色
if layout.paint.defaultUIStyle == "dark":
	layout.backColor = "rgb(0,0,0)"
	layout.borderColor = "rgb(100,100,100)"
	layout.textColor = "rgb(255,255,255)"
	layout.scrollBarColor = "rgb(100,100,100)"
elif layout.paint.defaultUIStyle == "light":
	layout.backColor = "rgb(255,255,255)"
	layout.borderColor = "rgb(150,150,150)"
	layout.textColor = "rgb(0,0,0)"
	layout.scrollBarColor = "rgb(200,200,200)"
#填充布局
layout.dock = "fill"       
#设置边距
layout.padding = FCPadding(10, 10, 10, 10)
#自动换行
layout.autoWrap = True
#创建子视图
for i in range(0,100):
	button = FCView()
	#添加到父视图
	addViewToParent(button, layout)
	button.text = str(i + 1)
	#根据主题配色
	if layout.paint.defaultUIStyle == "dark":
		button.backColor = "rgb(0,0,0)"
		button.borderColor = "rgb(100,100,100)"
		button.textColor = "rgb(255,255,255)"
	elif layout.paint.defaultUIStyle == "light":
		button.backColor = "rgb(255,255,255)"
		button.borderColor = "rgb(150,150,150)"
		button.textColor = "rgb(0,0,0)"
	#设置大小
	button.size = FCSize(100, 100)
	#设置位置
	button.location = FCPoint(0, 0)
	#设置外边距
	button.margin = FCPadding(10, 10, 10, 10)
#重置布局
resetLayoutDiv(layout)

updateViewDefault(gPaint.views)
showWindow(gPaint)